<div class="content">
    <div class="tl-img"><a class="<?php echo $this->controller; ?>"></a></div>
    <h1><?php echo $this->result->PAG_TITULO; ?></h1>
    <div class="texto">
        <?php echo $this->result->PAG_TEXTO; ?>
        <table class="calendario">
            <thead>
                <th width="150px"></th>
                <th>Descrição</th>
                <th>Endereço</th>
            </thead>
            <tbody>
        <?php
        foreach ($this->leituras as $res){
        ?>
            <tr>
                <td align="center"><?
                    $img = 'public/upload/leituras/'.$res->LEI_ID.'.*';
                    foreach (glob($img) as $src) $img = $src;
                     
                    if(strlen($res->LEI_LNK) > 0) $link = 'http://'.$res->LEI_LNK;  
                    else{
                        $pdf = 'public/upload/leituras/'.$res->LEI_ID.'_pdf.*';
                        foreach (glob($pdf) as $p) $link = $this->urlbase.'/'.$p;
                    } 
                        
                    ?>
                    <img src="<?php echo $this->urlbase.'/'.$img;?>"  height="100px" /></td>
                <td><?php echo $res->LEI_DES; ?></td>
                <td><?php if(strlen($link) > 0) { ?> <a href="<?php echo $link; ?>" target="_blank">Link de Acesso</a><?php } ?></td>
            </tr>
        <?php } ?>
            </tbody>
        </table>
    </div>      
</div>